#!/bin/sh

# Script to configure network interface with DHCP-assigned IP
# Usage: udhcpc -i [interface] -s /etc/udhcpc/set_ip

case "$1" in
    bound|renew)
        # Configure IP address and subnet mask
        ip addr add "$ip/$mask" dev "$interface"
        # Add default gateway
        ip route add default via "$router" dev "$interface"
        ;;
    deconfig)
        # Clean up configuration when releasing IP
        ip addr flush dev "$interface"
        ip route flush dev "$interface"
        ;;
esac